﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace NetDiskPRJ.BLL
{
    /// <summary>
    /// 系统单号表 逻辑类
    /// </summary>
    public class SysBillList
    {
        public SysBillList()
        {
        }
        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2013-02-20</date> 
        /// </summary>
        public List<NetDiskPRJ.Model.SysBillList> GetSysBillListAll()
        {
            DAL.SysBillList sysBillListDAL = new DAL.SysBillList();
            DataSet ds = sysBillListDAL.GetList("");
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 更新系统单号表数据表,根据修改列表
        /// <creator>wangl</creator>
        /// <date>2013-02-20</date>
        /// </summary>
        /// <param name="ModelAddList"></param>
        /// <param name="ModelDeleteList"></param>
        /// <param name="ModelUpdateList"></param>
        public void UpdateBySysBillModelList(List<Model.SysBillList> ModelUpdateList)
        {
            DAL.SysBillList sysBillListDAL = new DAL.SysBillList();
            sysBillListDAL.UpdateByModelList(ModelUpdateList);
        }


        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2013-02-20</date> 
        /// </summary>
        private List<NetDiskPRJ.Model.SysBillList> DataTableToList(DataTable dt)
        {
            DAL.SysBillList sysBillListDAL = new DAL.SysBillList();
            List<NetDiskPRJ.Model.SysBillList> modelList = new List<NetDiskPRJ.Model.SysBillList>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                NetDiskPRJ.Model.SysBillList model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = sysBillListDAL.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }
    }
}
